package com.cj.display_sys.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.cj.display_sys.R;

public class ImageText extends RelativeLayout {

	//private ImageView iv_big;
	private TextView txt1;
	private ImageView iv_small;
	private TextView txt2;

	public ImageText(Context context) {
		super(context);
		initView(context);
	}

	public ImageText(Context context, AttributeSet attrs) {
		super(context, attrs);
		initView(context);
		TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.ImgTxtValueView);
		//int imgBig = array.getResourceId(R.styleable.ImgTxtValueView_img_big, R.mipmap.ic_launcher);
		int imgSmall = array.getResourceId(R.styleable.ImgTxtValueView_img_small, R.mipmap.ic_launcher);
		String txt1 = array.getString(R.styleable.ImgTxtValueView_txt1);
		String txt2 = array.getString(R.styleable.ImgTxtValueView_txt2);

		this.txt1.setText(txt1);
		this.txt2.setText(txt2);
		//this.iv_big.setImageResource(imgBig);
		this.iv_small.setImageResource(imgSmall);


	}

	public ImageText(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);
		initView(context);
	}

	private void initView(Context context) {
		View.inflate(context, R.layout.layout_img_txt, this);
		//iv_big = this.findViewById(R.id.iv_icon1);
		iv_small = this.findViewById(R.id.iv_icon2);
		txt1 = this.findViewById(R.id.tv_c_txt1);
		txt2 = this.findViewById(R.id.tv_c_txt2);
	}
}